package com.taotao.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.taotao.common.resp.EasyUITreeNode;
import com.taotao.service.ItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by zzb on 2017/11/6.
 */
@Controller
@RequestMapping("/item/cat")
public class ItemCatController {

    @Reference
    private ItemCatService itemCatService;



    //加载item_add页面中类目
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    @ResponseBody
    public List<EasyUITreeNode> catList(@RequestParam(value = "id",defaultValue = "0") long parentId) {

        List<EasyUITreeNode> nodes = itemCatService.getCatList(parentId);

        return nodes;
    }
}
